using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_ShopConfig : Admin, IRequiresSessionState
{
	protected RadioButtonList rbShowShop;
	protected CheckBox CheckMember;
	protected RadioButtonList RadioTourist;
	protected RadioButtonList rb_UserTryClothesModel;
	protected CheckBox checkstandprice;
	protected CheckBox CheckAction;
	protected CheckBox CheckTeam;
	protected CheckBox CheckPromote;
	protected CheckBox CheckScore;
	protected DropDownList Droppayway;
	protected TextBox TxtFaHuo;
	protected RequiredFieldValidator RequiredFieldValidator1;
	protected RangeValidator Ra1;
	protected CheckBox CheckOnLine;
	protected CheckBox CheckLevelLine;
	protected CheckBox CheckVoidPay;
	protected CheckBox CheckQQ;
	protected CheckBox CheckWW;
	protected CheckBox CheckShowBuyer1;
	protected CheckBox CheckShowBuyer2;
	protected CheckBox CheckShowBuyer3;
	protected CheckBox CheckShowSaler1;
	protected CheckBox CheckShowSaler2;
	protected CheckBox CheckShowSaler3;
	protected CheckBox OpenShop1;
	protected CheckBox OpenShop2;
	protected CheckBox OpenShop3;
	protected TextBox SaleDay;
	protected DropDownList TeamSet;
	protected TextBox Team1Name;
	protected TextBox Team2Name;
	protected TextBox Team3Name;
	protected TextBox Team4Name;
	protected TextBox Team5Name;
	protected TextBox txtLotteryJifenEveryTime;
	protected RequiredFieldValidator RequiredFieldValidator2;
	protected Button Button1;
	private string MemberType = "0";
	private string Showstandprice = "0";
	private string ShowAction = "0";
	private string ShowTeam = "0";
	private string ShowPromote = "0";
	private string FahuoTiem = "1";
	private string ShowScore = "0";
	private string PayWay = "0";
	private string VoidPay = "0";
	private string Allowedtourist = "0";
	private string OnlinePay = "0";
	private string LeavePay = "0";
	private string ShowQQ = "0";
	private string ShowWW = "0";
	private string ShowBuyer1 = "0";
	private string ShowSaler1 = "0";
	private string ShowBuyer2 = "0";
	private string ShowSaler2 = "0";
	private string ShowBuyer3 = "0";
	private string ShowSaler3 = "0";
	private string UserTryClothesModel = "0";
	private string LotteryJifenEveryTime = "1";
	private ShopConfigBll _config = null;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected ShopConfigBll m_config
	{
		get
		{
			ShopConfigBll config;
			if (this._config == null)
			{
				this._config = new ShopConfigBll();
				config = this._config;
			}
			else
			{
				config = this._config;
			}
			return config;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(34))
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "ShopConfig");
			base.WriteRightErrMsg();
		}
		if (!base.IsPostBack)
		{
			this.BindConfig();
		}
	}
	protected void Button1_Click(object sender, EventArgs e)
	{
		if (!this.CheckAction.Checked && !this.checkstandprice.Checked && !this.CheckTeam.Checked)
		{
			this.WriteErrMsg("", "修改不成功,请至少选择一种交易模式!", "");
		}
		if (!this.CheckVoidPay.Checked && !this.CheckOnLine.Checked && !this.CheckLevelLine.Checked)
		{
			this.WriteErrMsg("", "修改不成功,请至少选择一种支付方式模式!", "");
		}
		if (this.CheckMember.Checked)
		{
			this.MemberType = "1";
		}
		if (this.RadioTourist.Items[0].Selected)
		{
			this.Allowedtourist = "0";
		}
		else
		{
			this.Allowedtourist = "1";
		}
		this.UserTryClothesModel = this.rb_UserTryClothesModel.GetRBLValue();
		if (this.UserTryClothesModel == "")
		{
			this.UserTryClothesModel = "0";
		}
		if (this.checkstandprice.Checked)
		{
			this.Showstandprice = "1";
		}
		if (this.CheckAction.Checked)
		{
			this.ShowAction = "1";
		}
		if (this.CheckTeam.Checked)
		{
			this.ShowTeam = "1";
		}
		if (this.CheckPromote.Checked)
		{
			this.ShowPromote = "1";
		}
		if (this.CheckScore.Checked)
		{
			this.ShowScore = "1";
		}
		this.PayWay = this.Droppayway.SelectedValue;
		this.FahuoTiem = this.TxtFaHuo.Text;
		if (this.CheckQQ.Checked)
		{
			this.ShowQQ = "1";
		}
		if (this.CheckWW.Checked)
		{
			this.ShowWW = "1";
		}
		if (this.CheckLevelLine.Checked)
		{
			this.LeavePay = "1";
		}
		if (this.CheckOnLine.Checked)
		{
			this.OnlinePay = "1";
		}
		if (this.CheckVoidPay.Checked)
		{
			this.VoidPay = "1";
		}
		if (this.CheckShowBuyer1.Checked)
		{
			this.ShowBuyer1 = "1";
		}
		if (this.CheckShowBuyer2.Checked)
		{
			this.ShowBuyer2 = "1";
		}
		if (this.CheckShowBuyer3.Checked)
		{
			this.ShowBuyer3 = "1";
		}
		if (this.CheckShowSaler1.Checked)
		{
			this.ShowSaler1 = "1";
		}
		if (this.CheckShowSaler2.Checked)
		{
			this.ShowSaler2 = "1";
		}
		if (this.CheckShowSaler3.Checked)
		{
			this.ShowSaler3 = "1";
		}
		this.LotteryJifenEveryTime = this.txtLotteryJifenEveryTime.Text.Trim();
		try
		{
			this.m_config.UpdateConfig(this.MemberType, this.Showstandprice, this.Allowedtourist, this.ShowAction, this.ShowTeam, this.ShowPromote, this.FahuoTiem, this.PayWay, this.VoidPay, this.OnlinePay, this.LeavePay, this.ShowQQ, this.ShowWW, this.ShowBuyer1, this.ShowSaler1, this.ShowBuyer2, this.ShowSaler2, this.ShowBuyer3, this.ShowSaler3, this.TeamSet.SelectedValue, this.Team5Name.Text, this.Team4Name.Text, this.Team3Name.Text, this.Team2Name.Text, this.Team1Name.Text, this.SaleDay.Text, this.rbShowShop.SelectedValue, this.ShowScore, this.UserTryClothesModel, this.LotteryJifenEveryTime);
		}
		catch (Exception ex)
		{
			this.WriteErrMsg("", ex.Message.ToString(), "");
		}
		base.WriteLog("Modify", Language.GetAdminMsg("Log/ObjectID", "0"), "ShopConfig");
		this.WriteSuccessMsg("", Language.GetAdminMsg("Common/EditSuccess"), "Admin_ShopConfig.aspx");
		this.BindConfig();
	}
	protected void BindConfig()
	{
		DataTable config = this.m_config.GetConfig();
		if (config.Rows.Count > 0)
		{
			this.rbShowShop.SelectedValue = config.Rows[0]["ShowShop"].ToString();
			if (config.Rows[0]["Member"].Equals("1"))
			{
				this.CheckMember.Checked = true;
			}
			else
			{
				this.CheckMember.Checked = false;
			}
			if (config.Rows[0]["Allowedtourist"].ToString() == "0")
			{
				this.RadioTourist.Items[0].Selected = true;
			}
			else
			{
				this.RadioTourist.Items[1].Selected = true;
			}
			if (config.Rows[0]["UserTryClothesModel"].IsNull(new object[0]) == "1")
			{
				this.rb_UserTryClothesModel.Items[1].Selected = true;
			}
			else
			{
				this.rb_UserTryClothesModel.Items[0].Selected = true;
			}
			if (config.Rows[0]["Showstandprice"].ToString() == "1")
			{
				this.checkstandprice.Checked = true;
			}
			if (config.Rows[0]["ShowAction"].ToString() == "1")
			{
				this.CheckAction.Checked = true;
			}
			if (config.Rows[0]["ShowTeam"].ToString() == "1")
			{
				this.CheckTeam.Checked = true;
			}
			if (config.Rows[0]["ShowPromote"].ToString() == "1")
			{
				this.CheckPromote.Checked = true;
			}
			if (config.Rows[0]["ShowScore"] != DBNull.Value)
			{
				if (config.Rows[0]["ShowScore"].ToString() == "1")
				{
					this.CheckScore.Checked = true;
				}
			}
			this.TxtFaHuo.Text = config.Rows[0]["FahuoTiem"].ToString();
			this.Droppayway.SelectedValue = config.Rows[0]["PayWay"].ToString();
			if (config.Rows[0]["ShowQQ"].ToString() == "1")
			{
				this.CheckQQ.Checked = true;
			}
			if (config.Rows[0]["ShowWW"].ToString() == "1")
			{
				this.CheckWW.Checked = true;
			}
			if (config.Rows[0]["VoidPay"].ToString() == "1")
			{
				this.CheckVoidPay.Checked = true;
			}
			if (config.Rows[0]["OnlinePay"].ToString() == "1")
			{
				this.CheckOnLine.Checked = true;
			}
			if (config.Rows[0]["LeavePay"].ToString() == "1")
			{
				this.CheckLevelLine.Checked = true;
			}
			if (config.Rows[0]["ShowSaler1"].ToString() == "1")
			{
				this.CheckShowSaler1.Checked = true;
			}
			if (config.Rows[0]["ShowSaler2"].ToString() == "1")
			{
				this.CheckShowSaler2.Checked = true;
			}
			if (config.Rows[0]["ShowSaler3"].ToString() == "1")
			{
				this.CheckShowSaler3.Checked = true;
			}
			if (config.Rows[0]["ShowBuyer1"].ToString() == "1")
			{
				this.CheckShowBuyer1.Checked = true;
			}
			if (config.Rows[0]["ShowBuyer2"].ToString() == "1")
			{
				this.CheckShowBuyer2.Checked = true;
			}
			if (config.Rows[0]["ShowBuyer3"].ToString() == "1")
			{
				this.CheckShowBuyer3.Checked = true;
			}
			this.TeamSet.SelectedValue = config.Rows[0]["TeamSet"].ToString();
			this.Team5Name.Text = config.Rows[0]["Team5Name"].ToString();
			this.Team4Name.Text = config.Rows[0]["Team4Name"].ToString();
			this.Team3Name.Text = config.Rows[0]["Team3Name"].ToString();
			this.Team2Name.Text = config.Rows[0]["Team2Name"].ToString();
			this.Team1Name.Text = config.Rows[0]["Team1Name"].ToString();
			this.SaleDay.Text = config.Rows[0]["SaleDay"].ToString();
			this.txtLotteryJifenEveryTime.Text = config.Rows[0]["LotteryJifenEveryTime"].ToString();
		}
	}
}
